//package com.ftg.youx.util;
//
//import com.rabbitmq.client.Channel;
//import com.rabbitmq.client.Connection;
//import com.rabbitmq.client.ConnectionFactory;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.stereotype.Component;
//
//import java.io.IOException;
//import java.util.concurrent.TimeoutException;
//
///**
// * mq的发送功能
// *  更改成为springboot+rabbitmq
// * @author 布衣
// */
//@Slf4j
//@Component
//public class MqUtil {
//
//    /**
//     * 发送消息
//     * @param message 消息
//     */
//    public void sendMessage(String message){
//        ConnectionFactory factory = new ConnectionFactory();
//        factory.setHost("localhost");
//        factory.setPort(5672);
//        factory.setVirtualHost("/");
//        factory.setUsername("guest");
//        factory.setPassword("guest");
//        try(
//                Connection connection =  factory.newConnection();
//                //创建频道
//                Channel channel = connection.createChannel();
//        ) {
//            String queueName = "queue01";
//            //创建队列
//            channel.queueDeclare(queueName,false,false,false,null);
//
//            channel.basicPublish("",queueName,null,message.getBytes());
//            log.info("向mq发送数据 : {}",message);
//
//        } catch (IOException | TimeoutException e) {
//            throw new RuntimeException(e);
//        }
//    }
//
//}
